from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import models
from django.urls import reverse


# 用户信息model 定义
class CrawlerTask(models.Model):
    name = models.CharField(max_length=30,verbose_name="任务名称")
    description = models.CharField(max_length=200,verbose_name="描述")
    runtime = models.CharField(max_length=30,verbose_name="运行时间")


    def __str__(self) -> str:
        return self.name

    class Meta:
        db_table = "CrawlerTask"
        managed = True
        verbose_name = "爬虫任务表"
        verbose_name_plural = verbose_name
        unique_together = ['id']
        # 可以在这里添加额外的验证逻辑，例如：
        # extra_kwargs = {
        #     'age': {'validators': [MinValueValidator(1), MaxValueValidator(1)]}
        # }
